package com.cyj.crm02.service.impl;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.cyj.crm02.entity.Customer;
import com.cyj.crm02.mapper.CustomerMapper;
import com.cyj.crm02.pojo.CustomerVo;
import com.cyj.crm02.service.CustomerService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

@Service
@Transactional
public class CustomerServiceImpl extends ServiceImpl<CustomerMapper, Customer> implements CustomerService {
    @Autowired
    private CustomerMapper customerMapper;

    @Override
    public IPage<CustomerVo> selectCustomerList(Page<CustomerVo> page, Integer employeeId) {

        if (employeeId==1){
           return customerMapper.selectCustomerList(page);
        }

        return customerMapper.selectCustomerListByEmployeeId(page,employeeId);
    }
}
